package com.gooluke.mybatis.controller;

import com.gooluke.mybatis.entity.TBookInfo;
import com.gooluke.mybatis.entity.TUserInfo;
import com.gooluke.mybatis.mapper.BookInfoMapper;
import com.gooluke.mybatis.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author gooluke
 * description
 * datetime 2025-06-17 18:53
 */
@RestController
@RequestMapping("/test")
public class TestController {

    @Autowired
    private UserMapper userMapper;
    @Autowired
    private BookInfoMapper bookInfoMapper;

    @RequestMapping("/user/query/{userId}")
    public TUserInfo selectByUserId(@PathVariable("userId") String userId) {
        return userMapper.selectByUserId(userId);
    }

    @RequestMapping("/book/query")
    public TBookInfo queryByName(@RequestParam("name") String name) {
        return bookInfoMapper.queryByName(name);
    }

}
